﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using HZ.MBSM.DBUtility;

public partial class Agency_Tra_lookhistory : System.Web.UI.Page
{
    string SupplyGoodsId;
    protected void Page_Load(object sender, EventArgs e)
    {

        SupplyGoodsId = SysFun.IsSQL(SysFun.ToTrim(Request.QueryString["SupplyGoodsId"]));
        System.Collections.Generic.List<HZ.MBSM.DAL.AccountType> _AccountType = new System.Collections.Generic.List<HZ.MBSM.DAL.AccountType>();
        _AccountType.Add(HZ.MBSM.DAL.AccountType.enumAttorney);
        if (HZ.MBSM.BLL.Login.CheckAssert(_AccountType))
        {
           
     
                Db db = new Db();
                DbPage dbPage = new DbPage(db);
                dbPage.Table = "SupplyPlan_Goods";                                               //表名，可以多个表关联
                dbPage.Key = "SupplyGoodsId";                                                                //该查询可以唯一表示记录的字段，该属性必须设置且只能有一个唯一标识字段
                dbPage.Where = " supplyGoodsId =" + SupplyGoodsId+" ";

                dbPage.SelectField = "historyPrice,historytime ";                     //可以不设，默认为“*”

                dbPage.OrderBy = "";                                //排序字段，可以不输入。不输入时以 Key 作为排序字段

                dbPage.PageIndex = SysFun.ToInt(Request.QueryString["PG"]);             //设置需要查询第几页
                dbPage.PageSize = 30;                                                   //设置每页显示多少条记录


                System.Text.StringBuilder sb = new System.Text.StringBuilder();

                sb.Append("<table border=1 cellpadding='0' cellspacing='0' style='border-collapse: collapse' bordercolor='#111111' width='98%' height='128'>");
                sb.Append("<tr style='font-weight:bold'>");
                sb.Append("<td nowrap align=center>调整日期</td>");
                
            sb.Append("<td nowrap align=center>调整价格</td>");
                sb.Append("</tr>");

                string str_historyPrice = "", str_historytime = "";
                int nNumber = 0;
                string[] strPrince ={  }, strtime ={  };
                System.Data.IDataReader dr = dbPage.ExecuteReader();
                while (dr.Read())
                {
                    str_historyPrice = SysFun.ToTrim(dr["historyPrice"]);
                    str_historytime = SysFun.ToTrim(dr["historytime"]);
                    strPrince=str_historyPrice.Split('|');
                    strtime=str_historytime.Split('|');
                    nNumber = strPrince.Length-1 ;
                }
                for (int i = nNumber; i > 0; i--)
                {
                    sb.Append("<tr>");
                    sb.Append("<td align=center>" + SysFun.ToTrim(strtime[i]) + "</td>");
                    sb.Append("<td align=center>" + SysFun.ToTrim(strPrince[i]) + "</td>");
                    sb.Append("</tr>");
                }
                dr.Close();
                sb.Append("</table>");
                Label1.Text = sb.ToString();   
                db.Close();

            
        }
    }
   

}
